package com.db.chat.server;

public class Command {
    private CommandEnum command;
    private String parameters;

    public Command( String textToParse) {
        int index = textToParse.indexOf(" ");
        if (index > 0) {
            command = CommandEnum.fromString(textToParse.substring(0, index));
            parameters = textToParse.substring(index + 1);
        } else {
            command = CommandEnum.fromString(textToParse);
        }
    }

    public  CommandEnum getCommand() {
        return command;
    }

    public  String getParameters() {
        return parameters;
    }
}
